subroutine judgement_function(Fp0,Fp1,Fp2,u1,u2,p1,p2,idxcase)
implicit none

    real(8) Fp0,Fp1,Fp2,u1,u2,p1,p2
    real(8) diff
    integer idxcase
    
    !idxcase=1 all shock wave
    !idxcase=2 left is expansion wave,right is shock wave
    !idxcase=3 right is expansion wave,left is shock wave
    !idxcase=4 all expansion wave
    !idxcase=5 all shock wave,but the kernal is Vacuum zone
    
    diff=u1-u2
    
    if(p1<=p2)then
        if(diff>=Fp2)then
            idxcase=1
        elseif(Fp2>diff>=Fp1)then
            idxcase=3
        elseif(Fp1>diff>=Fp0)then
            idxcase=4
        else
            idxcase=5
        endif
    endif
    
    if(p1>p2)then
        if(diff>=Fp1)then
            idxcase=1
        elseif(Fp1>diff>=Fp2)then
            idxcase=2
        elseif(Fp2>diff>=Fp0)then
            idxcase=4
        else
            idxcase=5
        endif
    endif
    
    
    
    
    
endsubroutine